<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>滴答办公系统-班级新增</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport"
		  content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="media/layui/css/layui.css" media="all">
	<link type="text/css" rel="stylesheet" href="/media/toastr/toastr.min.css">
	<script src="/media/js/jquery.min.js"></script>
	<script type="text/javascript" src="/media/toastr/toastr.min.js"></script>
</head>
<body>
<div class="layui-container" style="margin-top: 5px">
	<form class="layui-form" >
		<div class="layui-form-item">
			<label class="layui-form-label">原始密码</label>
			<div class="layui-input-block">
				<input type="password" name="name" lay-verify="name" autocomplete="off"
					   placeholder="请输入密码" class="layui-input" id="password1">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">新密码</label>
			<div class="layui-input-block">
				<input type="password" name="password" class="layui-input" id="password2">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">确认新密码</label>
			<div class="layui-input-block">
				<input type="password" name="password" class="layui-input" id="password3">
			</div>
		</div>
		<div class="layui-form-item">
			<input class="layui-btn"  style="margin-left: 10%" type="button" id="updatebt" value="确认修改">
		</div>
	</form>
</div>


<script src="media/layui/layui.js"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
	var form;
	layui.use([ 'form', 'laydate' ],
			function() {
				form = layui.form, layer = layui.layer, laydate = layui.laydate;
				//日期
				laydate.render({
					elem : '#date'
				});
				initData();
			});
	$("#updatebt").click(function () {
		var pass1 = $("#password1").val();
		var pass2 = $("#password2").val();
		var pass3 = $("#password3").val();
		if(pass2 == pass3){
			$.ajax({
				url:"updateEmpPass",
				data:{pass1:pass1,pass2:pass2},
				datatype:"json",
				success:function (data) {
					var a = JSON.parse(data)
					if(a.code==100){
						toastr.success(a.message)
						setTimeout(function () {
							location.href="main.html"
						},2000)
					}else{
						toastr.error(a.message)
					}
				}
			})
		}else{
			toastr.error("确认密码与新密码不一致!")
			// setTimeout(function(){
			// 	location.reload();
			// },2000)
		}
	})
</script>
</body>
</html>